const { defineConfig } = require('@vue/cli-service')
const path = require('path')
const Timestamp = new Date().getTime()

function resolve (dir) {
  return path.join(__dirname, dir)
}
module.exports = defineConfig({
  productionSourceMap: false,
  publicPath: './',
  transpileDependencies: true,
  lintOnSave: false,
  configureWebpack: {
    resolve: {
      alias: {
        '@': resolve('src')
      }
    },
    output: { // 输出重构  打包编译后的 文件名称  【模块名称.版本号.时间戳】
      filename: `js/[name].${Timestamp}.js`,
      chunkFilename: `js/[name].${Timestamp}.js`
    },
    devtool: process.env.NODE_ENV === 'production' ? false : 'source-map'
  },
  css: {
    loaderOptions: {
      sass: {
        // 支持多个scss样式文件，老版本sass-loader的options参数名为data,新版本sass-loader把data改为了prependData
        prependData: `@import "@/assets/css/global.scss";`
      }
    }
  }
})
